/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 * 
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */
@isTest
private class testUpdateCompanyDataInBO {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        string emailToCheck = 'jdoe@test.com'; 
		string emailOtherEmail = 'other@test.com';
				
		LINKSYS_SYS_PARAM__c sysParamObj = [Select VALUE__c from LINKSYS_SYS_PARAM__c
        	Where   PARAM_NAME__c = 'UpdateCompanyDataInBOTrigger' ];
		
		System.assertNotEquals(null, sysParamObj);
		
		System.assertNotEquals('', sysParamObj.VALUE__C.toUpperCase());
		
		if (sysParamObj.VALUE__C.toUpperCase() != 'ENABLED')
			return;
			
		try
		{
			System.debug('Testing account insert');
			Account a1 = new Account(Name='UnitTestAccount1');
			a1.Type = 'Registered';
			a1.Audio_Visual__c = true;
			a1.BillingCountry ='US';

			insert a1;
			
			System.debug('Testing account insert');
			Account a2 = new Account(Name='UnitTestAccount1-BO1');
			a2.Type = 'Registered';
			a2.BillingCountry ='US';
			a2.ParentId = a1.Id;
			a2.Audio_Visual__c = true;
			
			insert a2;
			
			a1.Business_Description__c = 'Business Description';
			a1.Currency__c = 'USD';
			a1.Gross_Revenue__c = '0-250,000';
			a1.Employees__c='1-9';
			a1.Industry = 'Computers';
			a1.Years_in_Business__c='1-2';
			a1.Website ='www.test.com'; 
			a1.Number_of_Stores_Locations__c = '1-5';
			a1.Audio_Visual__c = true;
			a1.Entertainment__c  = true;
			a1.Storage__c  = true;
			a1.Surveillance__c  = true;
			a1.Voice__c = true;
			a1.Wired__c = true;
			a1.Wireless__c = true;
			
			update a1;
			
		}
		catch (System.DmlException e) {
    		for (Integer i = 0; i < e.getNumDml(); i++) {
        		// Process exception here
        		System.debug(e.getDmlMessage(i));
			}
		}			
        
    }
}